package com.kea.firsthorse.shared;

import java.math.BigInteger;
import java.security.MessageDigest;

/**
 * Security.java
 * @author Stephan Marc Hansen
 */
public class Security implements SecurityIface {

	/* (non-Javadoc)
	 * @see com.kea.firsthorse.shared.SecurityIface#hashcrypt(java.lang.String)
	 */
	@Override
	public String hashcrypt(String in) {
		String out = ""; //$NON-NLS-1$
		try {
			MessageDigest md = MessageDigest.getInstance("MD5"); //$NON-NLS-1$
			byte[] messageDigest = md.digest(in.getBytes());
			BigInteger number = new BigInteger(1, messageDigest);
			out = number.toString(16); // :)
		} catch (Exception e) {
			e.printStackTrace();
		}
		return out;
	}

}
